﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.LightSwitch;
namespace LightSwitchApplication
{
    public partial class Vendor
    {
        partial void Name_Validate(EntityValidationResultsBuilder results)
        {
            // results.AddPropertyError("<Error-Message>");
            if (this.Name != null)
            {
                foreach (Vendor vendor in this.DataWorkspace.ApplicationData.Vendors)
                {
                    if (this.Name == vendor.Name && this != vendor)
                    {
                        results.AddPropertyError("Duplicated vendors:" + this.Name);
                        break;
                    }
                }
            }
        }
    }
}
